#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
    cout << "Enter n: ";
    int n;
    cin >> n;
    cout << endl;

    float fres = 0.0;
    float inv_fres = 0.0;
    double dres = 0.0;
    double inv_dres = 0.0;
    for (int i = 1; i <= n; ++i) {
        {
            const float ftmp = i;
            fres += (1.0f / (ftmp*ftmp));

            const float inv_ftmp = n - i + 1;
            inv_fres += (1.0f / (inv_ftmp * inv_ftmp));
        }

        {
            const double dtmp = i;
            dres += (1.0 / (dtmp*dtmp));

            const double inv_dtmp = n - i + 1;
            inv_dres += (1.0 / (inv_dtmp * inv_dtmp));
        }
    }

    printf("fres:\t%.6f\n", fres);
    printf("inv_fres:\t%.6f\n", inv_fres);
    printf("dres:\t%.14f\n", dres);
    printf("inv_dres:\t%.14f\n", inv_dres);

    cout << "fres:\t"     << fres     << endl
         << "inv_fres:\t" << inv_fres << endl
         << "dres:\t"     << dres     << endl
         << "inv_dres:\t" << inv_dres << endl;

    return 0;
}
